package com.wlyuan.open.scanner.utils.enums.bill;

import com.wlyuan.core.marker.NamedValue;
import com.wlyuan.core.marker.NamedValueMap;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Map;

/**
 * @author lijing
 * @description 对账单状态
 */
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
public enum PayTypeEnum implements NamedValue<Integer> {

    ADVANCE(1, 1, "预付"),
    COD(2, 2, "到付"),
    PAYSUB(3, 3, "代收"),
    RETURNPAY(4, 4, "回执");

    private final Integer value;
    private final Integer newValue;
    private final String name;

    private static final Map<Integer, PayTypeEnum> MAP = new NamedValueMap<>(PayTypeEnum.class);

    public static PayTypeEnum fromValue(Integer value) {
        return MAP.get(value);
    }

    public static boolean isReturnPay(Integer val) {
        return RETURNPAY.value.equals(val);
    }
}
